package com.ybdz.scanner.utils;


import android.app.Application;
import android.content.Context;
import android.os.Handler;


/**
 * @ClassName: MyApplication
 * @author: zhao
 * @Description:
 * @date 2017/12/11 14:22
 */
public class MyApplication extends Application {

    private static Context context;
    private static Handler mMainThreadHandler;
    private static int mMainThreadId;
    private static String ScannerClick;
    private static boolean isLogin;


    public static void setIsLogin(boolean isLogin) {
        MyApplication.isLogin = isLogin;
    }

    public static String getScannerClick() {
        return ScannerClick;
    }

    public static void setScannerClick(String scannerClick) {
        ScannerClick = scannerClick;
    }

    public static Context getContext() {
        return context;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        context=this;
        ScannerClick = null;
        //主线程的Handler
        mMainThreadHandler = new Handler();
        isLogin = false;
        /**
         * 获取主线程的线程id
         * myTid:Thread
         * myPid:Process
         */
        mMainThreadId = android.os.Process.myTid();

    }



    /**
     * 得到主线程里面的创建的一个hanlder
     */
    public static Handler getMainThreadHandler() {
        return mMainThreadHandler;
    }

    /**
     * 得到主线程的线程id
     */
    public static int getMainThreadId() {
        return mMainThreadId;
    }

    public static boolean getIsLogin() {
        return isLogin;
    }



}
